package com.example.demo.conf;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.example.annatation.TestFilter;

@Configuration
public class FilterConfigure {

	@Bean
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public FilterRegistrationBean registerAuthFilter() {
		FilterRegistrationBean registration = new FilterRegistrationBean();
		registration.setFilter(new TestFilter());
		registration.addUrlPatterns("/*");
		registration.setName("testFilter");
		registration.setOrder(1); // 值越小，Filter越靠前。
		return registration;
	}
}
